package peppa.george.base.Util;

import lombok.Data;

@Data
public class AjaxResult {

    private Boolean success;

    private String msg;

    public static AjaxResult me(){
        return new AjaxResult();
    }


    public AjaxResult success(){
        return AjaxResult.me().setSuccess(true).setMsg("请求成功！");
    }

    public AjaxResult fail(String msg){
        return AjaxResult.me().setSuccess(false).setMsg(msg);
    }

    public AjaxResult fail(){
        return AjaxResult.me().setSuccess(false).setMsg("请求失败！");
    }


    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }
}
